#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define R register
#define L long
#define LL long long
#define I inline
#define U unsigned

I LL read()
{
	R LL x;R char f;R char c;
	for (f=0; (c=getchar())<'0'||c>'9'; f=c=='-');
	for (x=c-'0'; (c=getchar())>='0'&&c<='9'; x=(x<<3)+(x<<1)+c-'0');
	return f?-x:x;
}

void swap(int *a,int *b)
{
    int tmp=*a;
    *a=*b;
    *b=tmp;
}


int a[10000];
int main()
{
    int n=read(),K=read();
    for(int i=0;i<n;a[i]=read(),++i);
    for(int k=0;k<K;++k)
        for(int i=0;i<n-1-k;++i)
            if(a[i]>a[i+1])
                swap(&a[i],&a[i+1]);
    for(int i=0;i<n;printf("%s%d",i?" ":"",a[i]),++i);
    
 	return 0;
}
